package com.sskj.finance.ui.activity;


import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.flyco.tablayout.SlidingTabLayout;
import com.sskj.common.adapter.MyFragmentPagerAdapter;
import com.sskj.common.base.App;
import com.sskj.finance.R;
import com.sskj.finance.R2;
import com.sskj.finance.presenter.AccountRecordActivityPresenter;
import com.sskj.lib.Constans;
import com.sskj.lib.RConfig;
import com.sskj.lib.base.BaseActivity;

import java.util.ArrayList;

import butterknife.BindView;

@Route(path = RConfig.FINAN_ACCOUNT_RECORD)//账单记录
public class AccountRecordActivity extends BaseActivity<AccountRecordActivityPresenter> {
    @BindView(R2.id.slidingTabLayout)
    SlidingTabLayout slidingTabLayout;
    @BindView(R2.id.viewPager)
    ViewPager viewPager;
    @Autowired
    boolean isTrade;
    private String[] titles = new String[]{App.INSTANCE.getString(R.string.finan_accountRecordActivity1_j), App.INSTANCE.getString(R.string.finan_accountRecordActivity2_j)};

    @Override
    protected int getLayoutId() {
        return R.layout.finan_activity_account_record;
    }

    @Override
    public AccountRecordActivityPresenter getPresenter() {
        return new AccountRecordActivityPresenter();
    }

    @Override
    protected void initView() {
        setTitle(App.INSTANCE.getString(R.string.finan_tradeAccountActivity3_j));
        ARouter.getInstance().inject(this);
        ArrayList<Fragment> fragments = new ArrayList<>();
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.FINAN_FRAGMENT_FINANCE).withBoolean(Constans.IS_TRADE, isTrade).navigation());
        fragments.add((Fragment) ARouter.getInstance().build(RConfig.FINAN_FRAGMENT_DYJK).withBoolean(Constans.IS_TRADE, isTrade).navigation());
        viewPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), fragments));
        slidingTabLayout.setViewPager(viewPager, titles);

    }


}
